} else
if (strcmp(fmp->key, "ICON_DESCR") == 0) {
wpt->icon_descr = csv_stringtrim(s, "", 0);
- wpt->icon_descr_is_dynamic = 1;
+ wpt->wpt_flags.icon_descr_is_dynamic = 1;
} else
/* LATITUDE CONVERSIONS**************************************************/
an1_copy copy;
} an1_base;
+/*
+ * Misc bitfields inside struct waypoint;
+ */
+typedef struct {
+ unsigned int icon_descr_is_dynamic:1;
+ unsigned int shortname_is_synthetic:1;
+} wp_flags;
+
/*
* This is a waypoint, as stored in the GPSR. It tries to not
* cater to any specific model or protocol. Anything that needs to
* be truncated, edited, or otherwise trimmed should be done on the
* way to the target.
*/
+
typedef struct {
queue Q; /* Master waypoint q. Not for use
by modules. */
char *notes;
char *url;
char *url_link_text;
- int icon_descr_is_dynamic;
- int shortname_is_synthetic;
+
+ wp_flags wpt_flags;
const char *icon_descr;
time_t creation_time; /* standardized in UTC/GMT */
int centiseconds; /* Optional hundredths of a second. */
void wpt_type(const char *args, const char **unused)
{
- wpt_tmp->icon_descr_is_dynamic = 1;
+ wpt_tmp->wpt_flags.icon_descr_is_dynamic = 1;
wpt_tmp->icon_descr = xstrdup(args);
}
wpt->longitude = lon;
wpt->altitude = alt;
wpt->icon_descr = category;
- wpt->icon_descr_is_dynamic = 1;
+ wpt->wpt_flags.icon_descr_is_dynamic = 1;
if (gid[0])
{
wpt_tmp->depth = fi.f;
fi.i = le_read32(&rec->wpt.d108.dist);
wpt_tmp->proximity = fi.f;
- wpt_tmp->icon_descr_is_dynamic = 0;
+ wpt_tmp->wpt_flags.icon_descr_is_dynamic = 0;
wpt_tmp->icon_descr = mps_find_desc_from_icon_number((rec->wpt.d108.smbl[1] << 8) + rec->wpt.d108.smbl[0], PCX);
waypt_add(wpt_tmp);
break;
case tt_rte_rtept_sym:
case tt_trk_trkseg_trkpt_sym:
wpt_tmp->icon_descr = xstrdup(cdatastrp);
- wpt_tmp->icon_descr_is_dynamic = 1;
+ wpt_tmp->wpt_flags.icon_descr_is_dynamic = 1;
break;
case tt_wpt_time:
case tt_trk_trkseg_trkpt_time:
/* GPX doesn't require a name on output, so if we made one up
* on input, we might as well say nothing.
*/
- if (!waypointp->shortname_is_synthetic) {
+ if (!waypointp->wpt_flags.shortname_is_synthetic) {
write_optional_xml_entity(ofd, " ", "name",
waypointp->shortname);
}
void ht_sym(const char *args, const char **unused)
{
wpt_tmp->icon_descr = xstrdup(args);
- wpt_tmp->icon_descr_is_dynamic = 1;
+ wpt_tmp->wpt_flags.icon_descr_is_dynamic = 1;
}
void ht_lat(const char *args, const char **unused)
*/
typedef unsigned char UC;
-typedef uint16 US;
+typedef gbuint16 US;
typedef gbuint16 uint16;
typedef gbint16 int16;
typedef gbuint32 uint32;
@echo.\r
CALL :COMPARE %TMPDIR%\tiger %TMPDIR%\tiger2\r
\r
+REM \r
+REM Lowrance USR. Binary, and also slightly lossy because of the math to\r
+REM convert lat/long. It also doesn't support description, which makes it\r
+REM awkward to test.\r
+REM \r
+DEL %TMPDIR%\lowrance1.usr\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i geo -f geocaching.loc -o lowranceusr -F %TMPDIR%\lowrance1.usr\r
+@echo off\r
+@echo.\r
+CALL :BINCOMPARE %TMPDIR%\lowrance1.usr reference\lowrance.usr\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i lowranceusr -f %TMPDIR%\lowrance1.usr -o lowranceusr -F %TMPDIR%\lowrance1.usr\r
+@echo off\r
+@echo.\r
+REM And because of the FP rounding, we can't even read our file, write it back\r
+REM and get the same data. Sigh. \r
+REM bincompare reference/lowrance.usr ${TMPDIR}/lowrance1.usr\r
+\r
REM CSV (Comma separated value) data.\r
\r
@echo on\r
%PNAME% -i holux -f reference\paris.wpo -o holux -F %TMPDIR%\paris.wpo\r
@echo off\r
@echo.\r
-CALL :COMPARE reference\paris.wpo %TMPDIR%\paris.wpo\r
+REM compare reference/paris.wpo ${TMPDIR}/paris.wpo\r
\r
REM Magellan NAV Companion for PalmOS\r
REM This format is hard to test, because each record and the database itself\r
@echo.\r
CALL :COMPARE %TMPDIR%\igc.gpx reference\igc2_gpx.out\r
\r
+REM \r
+REM Google Maps XML test\r
+REM \r
+DEL %TMPDIR%\google.out\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i google -f reference\google.xml -o arc -F %TMPDIR%\google.out\r
+@echo off\r
+@echo.\r
+CALL :COMPARE %TMPDIR%\google.out reference\google.arc\r
+\r
+DEL %TMPDIR%\google.out\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i google -f reference\google.js -o arc -F %TMPDIR%\google.out\r
+@echo off\r
+@echo.\r
+CALL :COMPARE %TMPDIR%\google.out reference\google.arc\r
+\r
+REM \r
+REM DeLorme .an1 tests\r
+REM \r
+DEL %TMPDIR%\an1.out\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i an1 -f reference\foo.an1 -o csv -F %TMPDIR%\an1.out\r
+@echo off\r
+@echo.\r
+CALL :COMPARE %TMPDIR%\an1.out reference\an1-in.ref\r
+\r
+DEL %TMPDIR%\an1.out\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i an1 -f reference\foo.an1 -o an1 -F %TMPDIR%\an1.out\r
+@echo off\r
+@echo.\r
+CALL :COMPARE %TMPDIR%\an1.out reference\an1-an1.ref\r
+\r
+DEL %TMPDIR%\an1.out\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i xmap -f reference\xmap -o an1 -F %TMPDIR%\an1.out \r
+@echo off\r
+@echo.\r
+CALL :COMPARE %TMPDIR%\an1.out reference\an1-out.ref\r
+\r
+DEL %TMPDIR%\an1.out\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i google -f reference\google.js -o an1 -F %TMPDIR%\an1.out\r
+@echo off\r
+@echo.\r
+CALL :COMPARE %TMPDIR%\an1.out reference\an1-line-out.ref\r
\r
REM \r
REM XCSV "human readable" tests\r
@echo off\r
@echo.\r
\r
+REM \r
+REM 'tabsep' isn't really tested in any non-trivial way, but we do exercise\r
+REM it.\r
+REM \r
+\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i geo -f geocaching.loc -o tabsep -F - | ${PNAME} -i tabsep -f - -o geo -F %TMPDIR%\tabsep.out\r
+%PNAME% -i geo -f geocaching.loc -o geo -F %TMPDIR%\geotabsep.out\r
+@echo off\r
+@echo.\r
+\r
+REM \r
+REM Now do the same for custom - it has the same issues.\r
+REM \r
+\r
+CALL :COMPARE %TMPDIR%\tabsep.out %TMPDIR%\geotabsep.out\r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i geo -f geocaching.loc -o custom -F - | ${PNAME} -i custom -f - -o geo -F %TMPDIR%\custom.out\r
+%PNAME% -i geo -f geocaching.loc -o geo -F %TMPDIR%\geocustom.out\r
+@echo off\r
+@echo.\r
+\r
+REM \r
+REM Write something to the various output-only formats\r
+REM \r
+@echo on\r
+@echo Testing...\r
+%PNAME% -i geo -f geocaching.loc -o text -F %TMPDIR%\text.out -o html -F %TMPDIR%\html.out -o vcard -F %TMPDIR%\vcard.out #-o palmdoc -F %TMPDIR%\pd.out\r
+@echo off\r
+@echo.\r
+\r
char tmpnam[10];
snprintf(tmpnam, sizeof(tmpnam), "RPT%03d",rte_waypts);
wpt->shortname = xstrdup(tmpnam);
- wpt->shortname_is_synthetic = 1;
+ wpt->wpt_flags.shortname_is_synthetic = 1;
}
}
tmp->url = xstrdup(wpt->url);
if (wpt->url_link_text)
tmp->url_link_text = xstrdup(wpt->url_link_text);
- if (wpt->icon_descr && wpt->icon_descr_is_dynamic)
+ if (wpt->icon_descr && wpt->wpt_flags.icon_descr_is_dynamic)
tmp->icon_descr = xstrdup(wpt->icon_descr);
if (wpt->gc_data.desc_short.utfstring) {
tmp->gc_data.desc_short.utfstring =
if (wpt->url_link_text) {
xfree(wpt->url_link_text);
}
- if (wpt->icon_descr && wpt->icon_descr_is_dynamic) {
+ if (wpt->icon_descr && wpt->wpt_flags.icon_descr_is_dynamic) {
xfree((char *)(void *)wpt->icon_descr);
}
if (wpt->gpx_extras) {